<?php
    //用户传递过来的uid
    $id = $_GET['id'];
	//echo $uid;
	 /* $pid = $_GET['pid'];
		echo $pid ;
	 */
    //链接数据库
     mysql_connect('localhost','root','');

    //选择数据库
    mysql_select_db('lamp111');

    mysql_set_charset('utf8');

    //准备SQL语句
	$sql = "delete from type where pid={$id}";
	//echo $sql;
	
	$result = mysql_query($sql);
	
	if(mysql_num_rows($result) > 0){
		$sql = 'delete from type where id='.$id;
		//mysql_query($sql);
		echo $sql;
	}else{
		echo '下面有子版块不可以删除';
	}

	
	
    //执行删除
    mysql_query($sql);

    //判断是否删除成功

    if(mysql_affected_rows() > 0 ){
        header('location:./type_menu.php');
    } 
    mysql_close(); 
?>
